#include "rmutils.h"
#include <QJsonDocument>
#include <QDebug>
#include <QJsonObject>
//sudo ./configure -static -release -nomake tests -qt-xcb -nomake examples -prefix /opt/qtstatic

RMUtils::RMUtils(QObject *parent) : QObject(parent)
{

}

QJsonObject RMUtils::QstringToJson(QString jsonString)
{
    QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonString.toLocal8Bit().data());
    if(jsonDocument.isNull())
    {
        qDebug()<< "String NULL"<< jsonString.toLocal8Bit().data();
    }
    QJsonObject jsonObject = jsonDocument.object();
    return jsonObject;
}

QString RMUtils::JsonToQstring(QJsonObject jsonObject)
{
    return QString(QJsonDocument(jsonObject).toJson());
}
